{% extends "./inc/base.html" %}
{% block content %}
                <section class="vbox">
                    <header class="header bg-light dk">
                        <p>{{controller.meta_title}}</p>
                    </header>
                    <section class="scrollable wrapper">

                        <section class="panel panel-default">
                            <header class="panel-heading">
                                咨询列表
                            </header>
                            <div class="row wrapper">
                                <!-- <div class="col-sm-9 m-b-xs">
                                </div> -->
                                <div class="col-sm-3">
                                    <div class="input-group pull-right search-form">
                                        <input type="text" class="input-sm form-control" name="q" placeholder="用户姓名|用户手机|公司名称|信息标题"
                                               value="{{controller.get('q')}}">
                                        <span class="input-group-btn">
                                            <button class="btn btn-sm btn-default" type="button" id="search" url="/admin/consult/index/">搜索</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-hover b-t b-light">
                                    <thead>
                                    <tr>
                                        <th>用户姓名</th>
                                        <th>用户手机</th>
                                        <th>公司名称</th>
                                        <th>信息标题</th>
                                        <th>时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for item in list %}
                                    <tr >
                                        <td><a href="/admin/user/showuser/?id={{item.uid}}" class="text-info" data-toggle="ajaxModal">{{item.real_name}}</a></td>
                                        <td>{{item.usermobile}}</td>
                                        <td>{{item.usergsmc}}</td>
                                        <td><a href="/admin/gongxufabu/see/?id={{item.gongxuid}}" class="text-info" data-toggle="ajaxModal">{{item.xinxibiaoti}} <i class="fa fa-search-plus"></i> </a> </td>
                                        <td>{{item.time | moment('YYYY-MM-DD HH:mm:ss')}}</td>
                                        <td>
                                            <a href="/admin/consult/see/?id={{item.id}}" class="btn btn-rounded btn-xs btn-icon btn-default" data-toggle="ajaxModal" title=""><i class="fa fa-search-plus"></i></a>
                                            <a href="/admin/consult/remark/?id={{item.id}}" class="btn btn-rounded btn-xs btn-icon btn-default" data-toggle="ajaxModal" title="" data-original-title="编辑"><i class="fa fa-pencil-square-o"></i></a>
                                        </td>
                                    </tr>
                                    {% else %}
                                    <tr><td colspan="11"><div class="alert alert-warning alert-block">
                                        <button data-dismiss="alert" class="close" type="button">×</button>
                                        <p>暂无数据</p>
                                    </div></td></tr>

                                    {% endfor %}


                                    </tbody>
                                </table>
                            </div>
                            <footer class="panel-footer">
                                <div class="row">


                                    <div class="col-sm-12 text-right text-center-xs">
                                        {{pagerData | safe}}
                                    </div>
                                </div>
                            </footer>
                        </section>
                    </section>
                </section>

{% endblock %}
{% block script%}
<script src="/static/admin/js/parsley/parsley.min.js"></script>
<script src="/static/admin/js/parsley/parsley.extend.js"></script>
<script>
    $(function () {
      //搜索功能
      $("#search").click(function(){
        var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
          url += '&' + query;
        }else{
          url += '?' + query;
        }
        window.location.href = url;
      });

      //回车自动提交
      $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
          $("#search").click();
        }
      });

    })
</script>
{% endblock%}